from CustomGuiItems.MyDockWidget import MyDockWidget;
from GraphSettings.GraphGuiSettings.StateTraceEvents.TraceEvents import TraceEvents;
from GraphSettings.GraphGuiSettings.StateTraceEvents.TraceEventsOptions import TraceEventsOptions;
from PyQt4 import QtGui, QtCore; #@UnusedImport

class TraceEventsPane(QtCore.QObject):    
    def __init__(self, parent):
        super(TraceEventsPane, self).__init__();
        self.parent = parent;
        self.mainWin = parent.mainWin;
        self.graphScene = parent.graphScene;
        self.dataView = self.parent.dataContainer.dataView;
        self.myDockWidget = MyDockWidget("Trace State Events", self.parent);
        self.mainWin.addDockWidget(QtCore.Qt.LeftDockWidgetArea, self.myDockWidget);
        self.createTabWidget();
        self.myDockWidget.setWidget(self.tabWidget);
        self.myDockWidget.setMinimumHeight(180);
        self.myDockWidget.setVisible(False);
        
    def createTabWidget(self):
        self.traceEvents = TraceEvents(self.parent);
        self.traceOpts = TraceEventsOptions(self, self.traceEvents);
        self.traceTbl = self.dataView.gridStTraceEvents;
        self.tabWidget = QtGui.QTabWidget(self.mainWin);
        self.tabWidget.insertTab(0, self.traceEvents.qWidget, "Trace");
        self.tabWidget.insertTab(1, self.traceOpts.qWidget, "Options");
        self.tabWidget.insertTab(2, self.traceTbl.gridStTraceEvents, "Edit");
        self.tabWidget.setTabPosition(QtGui.QTabWidget.West);
        
    def showTab(self, index):
        self.myDockWidget.setVisible(True);
        self.tabWidget.setCurrentIndex(index);
        
    def getDataSettings(self):
        return self.traceOpts.getDataSettings();
    
    def setDataSettings(self, dataSettings):
        self.traceOpts.setDataSettings(dataSettings);